<script setup lang="ts">
import { useStore } from '@/store/user'

import { useRouter, useRoute } from 'vue-router'
const user = useStore()
const router = useRouter()
const route = useRoute()

defineProps<{ msg?: string }>()


const to = () => {
    router.push('/about')
}


const min = () => {
    (window as any).nativeApi!.setMinSize('min')
}

const max = () => {
    (window as any).nativeApi!.setMaxSize()
}


const noticefy = (msg: string) => {
    (window as any).nativeApi!.setNotify(msg)
}

</script>

<template>
    <h1>{{ msg }}</h1>

    <div class="card">
        <div>
            这是从store来的值{{ user.age }}
        </div>
        <button @click="to">跳转</button>
        <button type="button" @click="user.increment()">点击改变值</button>
        <button type="button" @click="min">缩小窗口</button>
        <button type="button" @click="max">放大窗口</button>
        <button type="button" @click="noticefy('hello')">调用通知</button>
        <p>
            Edit
            <code>components/HelloWorld.vue</code> to test HMR
        </p>
    </div>

    <p>
        Check out
        <a href="https://vuejs.org/guide/quick-start.html#local" target="_blank">create-vue</a>, the official Vue + Vite
        starter
    </p>
    <p>
        Install
        <a href="https://github.com/vuejs/language-tools" target="_blank">Volar</a>
        in your IDE for a better DX
    </p>
    <p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>

<style scoped>
.read-the-docs {
    color: #888;
}
</style>
